<script src="/assets/js/smartpaginator.js" type="text/javascript"></script>
<script type="text/javascript">
	$(document).ready(function() {
		$('#booklet').smartpaginator({ totalrecords: <?php echo count($booklet_list); ?>, recordsperpage: 10, datacontainer: 'booklet_table', dataelement: 'tr', initval: 0, next: 'next', prev: 'prev', first: 'first', last: 'last', theme: 'green' });
	});
</script>
<div id="booklet" style="margin: auto;"></div>   
	<table id="booklet_table" width="100%" style="table-layout:fixed">
      <thead>
        <tr>
          <th width="5%">id</th>
          <th width="5%">类别</th>
          <th width="15%">书名</th>
          <th width="30%">描述</th>
          <th width="180px">图</th>
          <th width="5%">下载量</th>
          <th width="10%">创建者</th>
          <th width="8%">创建时间</th>
          <th width="8%">更新时间</th>
          <th width="200px">操作</th>
        </tr>
      </thead>
      <tbody>
        <?php
	foreach($booklet_list as $booklet)
	{
?>
        <tr>
          <td><?php echo $booklet->id; ?></td>
          <td style="word-wrap: break-word;word-break:break-all;"><?php echo $booklet->get_category_string(); ?></td>
		  <td>
<?php echo $booklet->name; 
	if ($booklet->lock == 'on')
	{
		echo "(锁)";
	}
?></td>
          <td style="word-wrap: break-word;word-break:break-all;"><?php echo $booklet->description; ?></td>
          <td><a href="/book/booklet/image?booklet_id=<?php echo $booklet->id;?>" target="_blank"> <img src="/book/booklet/image?booklet_id=<?php echo $booklet->id;?>"></a> </td>
          <td><?php echo $booklet->download_count; ?></td>
          <td style="word-wrap: break-word;word-break:break-all;"><?php echo $booklet->user_booklet->user->email; ?></td>
          <td><?php echo $booklet->create_time ? date('Y-m-d H:i:s', $booklet->create_time) : $booklet->create_time; ?></td>
          <td><?php echo $booklet->update_time ? date('Y-m-d H:i:s', $booklet->update_time) : $booklet->update_time; ?></td>
		  <td><a href="/admin/booklet/delete/<?php echo $booklet->id; ?>" onClick="var bl=confirm('真要删除?'); if(bl){return true;} else {return false;}" class="rates_button">删除</a> 
			<a target="_blank" href="/admin/booklet/modify/<?php echo $booklet->id; ?>" class="rates_button">编辑</a> 
			<a target="_blank" href="/admin/picture/list/<?php echo $booklet->id; ?>" class="rates_button">图片列表</a> 
			<a target="_blank" href="/admin/picture/add/<?php echo $booklet->id; ?>" class="rates_button">添加图片</a> </td>
        </tr>
        <?php
	}
?>
      </tbody>
    </table>
